package com.baby.springboot.consumer;

import org.springframework.amqp.rabbit.annotation.Exchange;
import org.springframework.amqp.rabbit.annotation.Queue;
import org.springframework.amqp.rabbit.annotation.QueueBinding;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;

import javax.naming.Binding;
import javax.swing.text.Style;
import java.lang.reflect.Member;
import java.util.Map;

@Component
public class RoutingConsumer {


    @RabbitListener(bindings={
            @QueueBinding(value = @Queue,
            exchange = @Exchange(value = "springboot_routing",
            type = "direct"),
            key ={"info", "warn", "error"})
    })
    public void consumer1(String massage){
        System.out.println("一号："+ massage);
    }

    @RabbitListener(bindings = {
            @QueueBinding(value = @Queue,
            exchange = @Exchange(value ="springboot_routing",
            type = "direct"),
            key = "error")
    })
    public void consumer2(String message){
        System.out.println("二号:"+message);
    }

}
